package cn.liyicun.test.freemarker;


import freemarker.template.Configuration;
import freemarker.template.TemplateModelException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;

@Component
@Slf4j
public class FreemarkerConfig {

    @Autowired
    private Configuration configuration;


    @PostConstruct
    public void setSharedVariable() throws TemplateModelException {

        List list=new ArrayList();
        list.add("common.ftl");
        log.info("---------FreemarkerConfig----------");
        configuration.setAutoIncludes(list);
    }
}


